load("//bazel:mongo_src_rules.bzl", "mongo_cc_benchmark", "mongo_cc_library", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

mongo_cc_library(
    name = "query_sbe_makeobj_spec",
    srcs = [
        "makeobj_spec.cpp",
        "size_estimator.cpp",
    ],
    hdrs = [
        "makeobj_spec.h",
        "size_estimator.h",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:sbe_values",
        "//src/mongo/util:field_set",  # TODO(SERVER-93876): Remove.
    ],
)

mongo_cc_library(
    name = "query_sbe",
    srcs = [
        "extended_types.cpp",
        "sbe_pattern_value_cmp.cpp",
        "sort_spec.cpp",
        "//src/mongo/db/exec/sbe/expressions:compile_ctx.cpp",
        "//src/mongo/db/exec/sbe/expressions:expression.cpp",
        "//src/mongo/db/exec/sbe/expressions:runtime_environment.cpp",
        "//src/mongo/db/exec/sbe/util:debug_print.cpp",
        "//src/mongo/db/exec/sbe/util:pcre.cpp",
        "//src/mongo/db/exec/sbe/util:spilling.cpp",
        "//src/mongo/db/exec/sbe/util:stage_results_printer.cpp",
        "//src/mongo/db/exec/sbe/vm:code_fragment.cpp",
        "//src/mongo/db/exec/sbe/vm:vm.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_arith.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_block.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_acc_finalize.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_agg.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_arith.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_array.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_bit.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_bool.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_bson.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_datetime.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_hash.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_keystring.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_makebsonobj.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_makeobj.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_object.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_predicate.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_regex.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_set.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_sortkey.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_builtin_string.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_datetime.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_instruction.cpp",
        "//src/mongo/db/exec/sbe/vm:vm_printer.cpp",
    ],
    hdrs = [
        "sbe_pattern_value_cmp.h",
        "sort_spec.h",
        "//src/mongo/db/exec/sbe:accumulator_sum_value_enum.h",
        "//src/mongo/db/exec/sbe:in_list.h",
        "//src/mongo/db/exec/sbe/expressions:compile_ctx.h",
        "//src/mongo/db/exec/sbe/expressions:expression.h",
        "//src/mongo/db/exec/sbe/expressions:runtime_environment.h",
        "//src/mongo/db/exec/sbe/util:debug_print.h",
        "//src/mongo/db/exec/sbe/util:pcre.h",
        "//src/mongo/db/exec/sbe/util:spilling.h",
        "//src/mongo/db/exec/sbe/util:stage_results_printer.h",
        "//src/mongo/db/exec/sbe/vm:code_fragment.h",
        "//src/mongo/db/exec/sbe/vm:vm.h",
        "//src/mongo/db/exec/sbe/vm:vm_builtin.h",
        "//src/mongo/db/exec/sbe/vm:vm_datetime.h",
        "//src/mongo/db/exec/sbe/vm:vm_instruction.h",
        "//src/mongo/db/exec/sbe/vm:vm_memory.h",
        "//src/mongo/db/exec/sbe/vm:vm_printer.h",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:mongohasher",
        "//src/mongo/db:sbe_values",
        "//src/mongo/db:shard_role_api",
        "//src/mongo/db/concurrency:exception_util",
        "//src/mongo/db/exec/sbe:query_sbe_makeobj_spec",
        "//src/mongo/db/fts:base_fts",
        "//src/mongo/db/index:index_access_method",
        "//src/mongo/db/query:query_index_bounds",
        "//src/mongo/db/query:random_utils",
        "//src/mongo/db/query:sort_pattern",
        "//src/mongo/db/query:spill_util",
        "//src/mongo/db/query:str_trim_utils",
        "//src/mongo/db/query:substr_utils",
        "//src/mongo/db/query/bson:dotted_path_support",
        "//src/mongo/db/sorter:sorter_base",
        "//src/mongo/db/sorter:sorter_stats",
        "//src/mongo/db/storage:record_store_base",
        "//src/mongo/util:field_set",
        "//src/third_party/snappy",
    ],
)

mongo_cc_library(
    name = "query_sbe_plan_stats",
    srcs = [
        "//src/mongo/db/exec/sbe/stages:plan_stats.cpp",
    ],
    hdrs = [
        "//src/mongo/base:clonable_ptr.h",
        "//src/mongo/base:encoded_value_storage.h",
        "//src/mongo/base:secure_allocator.h",
        "//src/mongo/bson:bson_duration.h",
        "//src/mongo/bson:bson_time_support.h",
        "//src/mongo/bson/mutable:api.h",
        "//src/mongo/bson/mutable:element.h",
        "//src/mongo/client:connection_string.h",
        "//src/mongo/crypto:hash_block.h",
        "//src/mongo/crypto:sha256_block.h",
        "//src/mongo/db:basic_types.h",
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db:baton.h",
        "//src/mongo/db:client.h",
        "//src/mongo/db:cluster_role.h",
        "//src/mongo/db:database_name.h",
        "//src/mongo/db:database_name_reserved.def.h",
        "//src/mongo/db:feature_compatibility_version_parser.h",
        "//src/mongo/db:feature_flag.h",
        "//src/mongo/db:field_ref.h",
        "//src/mongo/db:logical_time.h",
        "//src/mongo/db:namespace_string.h",
        "//src/mongo/db:namespace_string_reserved.def.h",
        "//src/mongo/db:operation_context.h",
        "//src/mongo/db:operation_id.h",
        "//src/mongo/db:read_write_concern_provenance.h",
        "//src/mongo/db:read_write_concern_provenance_base_gen",
        "//src/mongo/db:record_id.h",
        "//src/mongo/db:record_id_helpers.h",
        "//src/mongo/db:server_options.h",
        "//src/mongo/db:server_parameter.h",
        "//src/mongo/db:server_parameter_with_storage.h",
        "//src/mongo/db:service_context.h",
        "//src/mongo/db:tenant_id.h",
        "//src/mongo/db:write_concern_gen",
        "//src/mongo/db:write_concern_idl.h",
        "//src/mongo/db:write_concern_options.h",
        "//src/mongo/db/admission:execution_admission_context.h",
        "//src/mongo/db/auth:action_set.h",
        "//src/mongo/db/auth:action_type.h",
        "//src/mongo/db/auth:action_type_gen",
        "//src/mongo/db/auth:auth_name.h",
        "//src/mongo/db/auth:privilege.h",
        "//src/mongo/db/auth:resource_pattern.h",
        "//src/mongo/db/auth:restriction_environment.h",
        "//src/mongo/db/auth:role_name.h",
        "//src/mongo/db/auth:user_name.h",
        "//src/mongo/db/auth:validated_tenancy_scope.h",
        "//src/mongo/db/auth:validated_tenancy_scope_factory.h",
        "//src/mongo/db/catalog:clustered_collection_options_gen",
        "//src/mongo/db/catalog/validate:validate_results.h",
        "//src/mongo/db/concurrency:cond_var_lock_grant_notification.h",
        "//src/mongo/db/concurrency:fast_map_noalloc.h",
        "//src/mongo/db/concurrency:flow_control_ticketholder.h",
        "//src/mongo/db/concurrency:lock_manager_defs.h",
        "//src/mongo/db/concurrency:lock_stats.h",
        "//src/mongo/db/concurrency:locker.h",
        "//src/mongo/db/exec:plan_stats.h",
        "//src/mongo/db/exec:plan_stats_visitor.h",
        "//src/mongo/db/exec:plan_stats_walker.h",
        "//src/mongo/db/exec/document_value:document.h",
        "//src/mongo/db/exec/document_value:document_internal.h",
        "//src/mongo/db/exec/document_value:document_metadata_fields.h",
        "//src/mongo/db/exec/document_value:value.h",
        "//src/mongo/db/exec/document_value:value_internal.h",
        "//src/mongo/db/exec/sbe/stages:plan_stats.h",
        "//src/mongo/db/index:multikey_paths.h",
        "//src/mongo/db/index_builds:resumable_index_builds_gen",
        "//src/mongo/db/pipeline:field_path.h",
        "//src/mongo/db/query:eof_node_type.h",
        "//src/mongo/db/query:explain_options.h",
        "//src/mongo/db/query:explain_verbosity_gen",
        "//src/mongo/db/query:plan_summary_stats.h",
        "//src/mongo/db/query:plan_summary_stats_visitor.h",
        "//src/mongo/db/query:query_feature_flags_gen",
        "//src/mongo/db/query:record_id_bound.h",
        "//src/mongo/db/query:stage_types.h",
        "//src/mongo/db/query:tree_walker.h",
        "//src/mongo/db/query/client_cursor:cursor_idl_validator.h",
        "//src/mongo/db/query/client_cursor:cursor_response_gen",
        "//src/mongo/db/query/collation:collation_spec.h",
        "//src/mongo/db/query/collation:collator_interface.h",
        "//src/mongo/db/query/datetime:date_time_support.h",
        "//src/mongo/db/query/query_shape:serialization_options.h",
        "//src/mongo/db/query/query_stats:data_bearing_node_metrics.h",
        "//src/mongo/db/repl:optime.h",
        "//src/mongo/db/session:logical_session_id.h",
        "//src/mongo/db/session:logical_session_id_gen",
        "//src/mongo/db/session:logical_session_id_helpers.h",
        "//src/mongo/db/sorter:sorter_gen",
        "//src/mongo/db/storage:compact_options.h",
        "//src/mongo/db/storage:ident.h",
        "//src/mongo/db/storage:key_format.h",
        "//src/mongo/db/storage:record_data.h",
        "//src/mongo/db/storage:record_store.h",
        "//src/mongo/db/storage:recovery_unit.h",
        "//src/mongo/db/storage:snapshot.h",
        "//src/mongo/db/storage:storage_engine.h",
        "//src/mongo/db/storage:storage_stats.h",
        "//src/mongo/db/storage:temporary_record_store.h",
        "//src/mongo/db/storage:write_unit_of_work.h",
        "//src/mongo/idl:command_generic_argument.h",
        "//src/mongo/idl:idl_parser.h",
        "//src/mongo/platform:atomic_proxy.h",
        "//src/mongo/rpc:message.h",
        "//src/mongo/rpc:op_msg.h",
        "//src/mongo/transport:session.h",
        "//src/mongo/transport:session_id.h",
        "//src/mongo/util:cancellation.h",
        "//src/mongo/util:container_size_helper.h",
        "//src/mongo/util:database_name_util.h",
        "//src/mongo/util:fail_point.h",
        "//src/mongo/util:inline_memory.h",
        "//src/mongo/util:make_array_type.h",
        "//src/mongo/util:namespace_string_util.h",
        "//src/mongo/util:periodic_runner.h",
        "//src/mongo/util:safe_num.h",
        "//src/mongo/util:scoped_unlock.h",
        "//src/mongo/util:secure_compare_memory.h",
        "//src/mongo/util:serialization_context.h",
        "//src/mongo/util/concurrency:admission_context.h",
        "//src/mongo/util/concurrency:lock_free_read_list.h",
        "//src/mongo/util/concurrency:spin_lock.h",
        "//src/mongo/util/concurrency:ticketholder.h",
        "//src/mongo/util/net:cidr.h",
        "//src/mongo/util/net:hostandport.h",
        "//src/mongo/util/net:sockaddr.h",
        "//src/mongo/util/net:ssl_peer_info.h",
        "//src/mongo/util/net:ssl_types.h",
        "//src/mongo/util/version:releases_header",
    ],
    header_deps = [
        "//src/mongo/bson/column",
        "//src/mongo/db/auth:cluster_auth_mode",
        "//src/mongo/db/fts:fts_query_noop",
        "//src/mongo/platform:visibility_test_libcommon",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db/stats:counter_ops",
        "//src/mongo/db/storage:damage_vector",
    ],
)

mongo_cc_library(
    name = "query_sbe_stages",
    srcs = [
        "//src/mongo/db/exec/sbe/stages:agg_project.cpp",
        "//src/mongo/db/exec/sbe/stages:block_hashagg.cpp",
        "//src/mongo/db/exec/sbe/stages:block_to_row.cpp",
        "//src/mongo/db/exec/sbe/stages:branch.cpp",
        "//src/mongo/db/exec/sbe/stages:bson_scan.cpp",
        "//src/mongo/db/exec/sbe/stages:co_scan.cpp",
        "//src/mongo/db/exec/sbe/stages:exchange.cpp",
        "//src/mongo/db/exec/sbe/stages:hash_agg.cpp",
        "//src/mongo/db/exec/sbe/stages:hash_join.cpp",
        "//src/mongo/db/exec/sbe/stages:hash_lookup.cpp",
        "//src/mongo/db/exec/sbe/stages:hash_lookup_unwind.cpp",
        "//src/mongo/db/exec/sbe/stages:hashagg_base.cpp",
        "//src/mongo/db/exec/sbe/stages:limit_skip.cpp",
        "//src/mongo/db/exec/sbe/stages:lookup_hash_table.cpp",
        "//src/mongo/db/exec/sbe/stages:loop_join.cpp",
        "//src/mongo/db/exec/sbe/stages:makeobj.cpp",
        "//src/mongo/db/exec/sbe/stages:merge_join.cpp",
        "//src/mongo/db/exec/sbe/stages:project.cpp",
        "//src/mongo/db/exec/sbe/stages:search_cursor.cpp",
        "//src/mongo/db/exec/sbe/stages:sort.cpp",
        "//src/mongo/db/exec/sbe/stages:sorted_merge.cpp",
        "//src/mongo/db/exec/sbe/stages:spool.cpp",
        "//src/mongo/db/exec/sbe/stages:traverse.cpp",
        "//src/mongo/db/exec/sbe/stages:ts_bucket_to_cell_block.cpp",
        "//src/mongo/db/exec/sbe/stages:union.cpp",
        "//src/mongo/db/exec/sbe/stages:unique.cpp",
        "//src/mongo/db/exec/sbe/stages:unwind.cpp",
        "//src/mongo/db/exec/sbe/stages:virtual_scan.cpp",
        "//src/mongo/db/exec/sbe/stages:window.cpp",
        "//src/mongo/db/query:explain.h",
        "//src/mongo/db/query:plan_explainer_sbe.h",
        "//src/mongo/db/query:plan_ranker.h",
        "//src/mongo/db/query:sbe_plan_ranker.h",
        "//src/mongo/db/query/plan_cache:sbe_plan_cache.h",
        "//src/mongo/db/query/stage_builder/sbe:builder_data.h",
    ],
    hdrs = [
        "//src/mongo/db/exec/sbe/stages:agg_project.h",
        "//src/mongo/db/exec/sbe/stages:block_hashagg.h",
        "//src/mongo/db/exec/sbe/stages:block_to_row.h",
        "//src/mongo/db/exec/sbe/stages:branch.h",
        "//src/mongo/db/exec/sbe/stages:bson_scan.h",
        "//src/mongo/db/exec/sbe/stages:co_scan.h",
        "//src/mongo/db/exec/sbe/stages:exchange.h",
        "//src/mongo/db/exec/sbe/stages:filter.h",
        "//src/mongo/db/exec/sbe/stages:hash_agg.h",
        "//src/mongo/db/exec/sbe/stages:hash_join.h",
        "//src/mongo/db/exec/sbe/stages:hash_lookup.h",
        "//src/mongo/db/exec/sbe/stages:hash_lookup_unwind.h",
        "//src/mongo/db/exec/sbe/stages:hashagg_base.h",
        "//src/mongo/db/exec/sbe/stages:limit_skip.h",
        "//src/mongo/db/exec/sbe/stages:lookup_hash_table.h",
        "//src/mongo/db/exec/sbe/stages:loop_join.h",
        "//src/mongo/db/exec/sbe/stages:makeobj.h",
        "//src/mongo/db/exec/sbe/stages:merge_join.h",
        "//src/mongo/db/exec/sbe/stages:project.h",
        "//src/mongo/db/exec/sbe/stages:search_cursor.h",
        "//src/mongo/db/exec/sbe/stages:sort.h",
        "//src/mongo/db/exec/sbe/stages:sorted_merge.h",
        "//src/mongo/db/exec/sbe/stages:sorted_stream_merger.h",
        "//src/mongo/db/exec/sbe/stages:spool.h",
        "//src/mongo/db/exec/sbe/stages:stage_visitors.h",
        "//src/mongo/db/exec/sbe/stages:traverse.h",
        "//src/mongo/db/exec/sbe/stages:ts_bucket_to_cell_block.h",
        "//src/mongo/db/exec/sbe/stages:union.h",
        "//src/mongo/db/exec/sbe/stages:unique.h",
        "//src/mongo/db/exec/sbe/stages:unwind.h",
        "//src/mongo/db/exec/sbe/stages:virtual_scan.h",
        "//src/mongo/db/exec/sbe/stages:window.h",
    ],
    deps = [
        ":query_sbe",
        ":query_sbe_plan_stats",
        ":query_sbe_storage",
        "//src/mongo/db:sbe_values",
        "//src/mongo/db:server_base",
        "//src/mongo/db:service_context",
        "//src/mongo/db/concurrency:lock_manager",
        "//src/mongo/db/exec:js_function",
        "//src/mongo/db/exec:scoped_timer",
        "//src/mongo/db/pipeline",
        "//src/mongo/db/query:plan_yield_policy",
        "//src/mongo/db/query:query_index_bounds",
        "//src/mongo/db/query:spill_util",
        "//src/mongo/db/query/bson:dotted_path_support",
        "//src/mongo/db/sorter:sorter_base",
        "//src/mongo/db/sorter:sorter_stats",
        "//src/mongo/db/stats:resource_consumption_metrics",
        "//src/mongo/db/storage:encryption_hooks",
        "//src/mongo/db/storage:index_entry_comparison",
        "//src/mongo/db/storage:storage_options",
        "//src/mongo/executor:task_executor_cursor",
        "//src/mongo/util/concurrency:thread_pool",
        "//src/third_party/snappy",
    ],
)

mongo_cc_library(
    name = "query_sbe_storage",
    srcs = [
        "//src/mongo/db/exec/sbe/stages:collection_helpers.cpp",
        "//src/mongo/db/exec/sbe/stages:ix_scan.cpp",
        "//src/mongo/db/exec/sbe/stages:scan.cpp",
    ],
    hdrs = [
        "//src/mongo/db/exec/sbe/stages:collection_helpers.h",
        "//src/mongo/db/exec/sbe/stages:ix_scan.h",
        "//src/mongo/db/exec/sbe/stages:scan.h",
    ],
    deps = [
        ":query_sbe",
        "//src/mongo/db:shard_role",
        "//src/mongo/db/exec:scoped_timer",
        "//src/mongo/db/index:index_access_method",
        "//src/mongo/db/query:query_index_bounds",
        "//src/mongo/db/storage:execution_context",
        "//src/mongo/db/storage:index_entry_comparison",
    ],
)

mongo_cc_library(
    name = "query_sbe_abt",
    srcs = [
        "//src/mongo/db/exec/sbe/abt:abt_lower.cpp",
    ],
    hdrs = [
        "//src/mongo/db/exec/sbe/abt:abt_lower.h",
        "//src/mongo/db/exec/sbe/abt:abt_lower_defs.h",
    ],
    deps = [
        ":query_sbe",
        ":query_sbe_stages",
        ":query_sbe_storage",
        "//src/mongo/db/query/optimizer:optimizer_base",
    ],
)

mongo_cc_library(
    name = "sbe_plan_stage_test",
    srcs = [
        "sbe_plan_stage_test.cpp",
    ],
    hdrs = [
        "sbe_plan_stage_test.h",
    ],
    deps = [
        ":query_sbe",
        ":query_sbe_stages",
        "//src/mongo/db:query_exec",
        "//src/mongo/db:service_context_d_test_fixture",
        "//src/mongo/db/auth:authmocks",
        "//src/mongo/db/catalog:catalog_test_fixture",
        "//src/mongo/db/query:query_test_service_context",
        "//src/mongo/executor:network_interface_mock",
        "//src/mongo/executor:task_executor_cursor",
        "//src/mongo/executor:task_executor_interface",
        "//src/mongo/executor:thread_pool_task_executor",
        "//src/mongo/executor:thread_pool_task_executor_test_fixture",
        "//src/mongo/unittest",
    ],
)

# Lightweight test utils.
mongo_cc_library(
    name = "abt_unit_test_utils",
    srcs = [
        "//src/mongo/db/exec/sbe/abt:abt_unit_test_utils.cpp",
    ],
    hdrs = [
        "//src/mongo/db/exec/sbe/abt:abt_unit_test_literals.h",
        "//src/mongo/db/exec/sbe/abt:abt_unit_test_utils.h",
    ],
    deps = [
        "//src/mongo/db/query/bson:dotted_path_support",
        "//src/mongo/db/query/optimizer:optimizer_base",
        "//src/mongo/unittest",
    ],
)

mongo_cc_unit_test(
    name = "abt_unit_test_infra_test",
    srcs = [
        "//src/mongo/db/exec/sbe/abt:abt_unit_test_infra_test.cpp",
    ],
    tags = ["mongo_unittest_third_group"],
    deps = [
        ":abt_unit_test_utils",
        "//src/mongo/db/exec/sbe:query_sbe",  # needed to register extended type destruction for MakeObjSpec :(
    ],
)

mongo_cc_unit_test(
    name = "makeobj_spec_hash_test",
    srcs = [
        "expression_test_base.h",
        "makeobj_spec_hash_test.cpp",
        "sbe_unittest.h",
    ],
    tags = ["mongo_unittest_first_group"],
    deps = [
        ":query_sbe_abt",
        ":query_sbe_makeobj_spec",
        "//src/mongo/db/pipeline:expression_context_for_test",
        "//src/mongo/db/query:query_test_service_context",
    ],
)

mongo_cc_unit_test(
    name = "sbe_abt_test",
    srcs = [
        "//src/mongo/db/exec/sbe:expression_test_base.h",
        "//src/mongo/db/exec/sbe:sbe_unittest.h",
        "//src/mongo/db/exec/sbe/abt:sbe_abt_test.cpp",
    ],
    tags = ["mongo_unittest_fourth_group"],
    deps = [
        ":abt_unit_test_utils",
        ":query_sbe_abt",
        "//src/mongo/db:query_exec",
        "//src/mongo/db:service_context_d_test_fixture",
        "//src/mongo/db/pipeline:expression_context_for_test",
        "//src/mongo/db/query:query_test_service_context",
        "//src/mongo/db/query/collation:collator_interface_mock",
    ],
)

mongo_cc_unit_test(
    name = "abt_lower_test",
    srcs = [
        "//src/mongo/db/exec/sbe/abt:abt_lower_test.cpp",
    ],
    tags = ["mongo_unittest_fourth_group"],
    deps = [
        ":abt_unit_test_utils",
        ":query_sbe_abt",
        "//src/mongo/unittest",
    ],
)

mongo_cc_unit_test(
    name = "db_sbe_test",
    srcs = [
        "expression_test_base.h",
        "sbe_agg_project_test.cpp",
        "sbe_block_hashagg_test.cpp",
        "sbe_block_stages_test.cpp",
        "sbe_block_test_helpers.h",
        "sbe_code_fragment_test.cpp",
        "sbe_filter_test.cpp",
        "sbe_hash_agg_test.cpp",
        "sbe_hash_join_test.cpp",
        "sbe_hash_lookup_shared_test.cpp",
        "sbe_hash_lookup_shared_test.h",
        "sbe_hash_lookup_test.cpp",
        "sbe_hash_lookup_unwind_test.cpp",
        "sbe_key_string_test.cpp",
        "sbe_limit_skip_test.cpp",
        "sbe_loop_join_test.cpp",
        "sbe_math_builtins_test.cpp",
        "sbe_merge_join_test.cpp",
        "sbe_mkobj_test.cpp",
        "sbe_numeric_convert_test.cpp",
        "sbe_pattern_value_cmp.h",
        "sbe_pattern_value_cmp_test.cpp",
        "sbe_plan_size_test.cpp",
        "sbe_plan_stage_test.h",
        "sbe_search_cursor_test.cpp",
        "sbe_sort_test.cpp",
        "sbe_sorted_merge_test.cpp",
        "sbe_spool_test.cpp",
        "sbe_test.cpp",
        "sbe_trial_run_tracker_test.cpp",
        "sbe_unique_test.cpp",
        "sbe_unittest.cpp",
        "sbe_unittest.h",
        "sbe_window_test.cpp",
        "write_value_to_stream_test.cpp",
        "//src/mongo/db/exec:shard_filterer_mock.h",
        "//src/mongo/db/exec/sbe/expressions:sbe_array_set_conversion_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_block_expr_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_block_top_bottom_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_bson_size_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_coerce_to_string_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_collIsMember_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_concat_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_constant_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_covariance_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_date_add_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_date_diff_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_date_expression_accepting_timezone_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_date_from_string_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_date_to_parts_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_date_to_string_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_date_trunc_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_derivative_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_exp_moving_avg_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_extract_sub_array_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_fail_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_fill_type_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_firstn_lastn_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_get_element_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_if_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_index_of_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_integral_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_is_array_empty_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_is_member_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_iso_date_to_parts_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_ks_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_lambda_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_linearfill_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_local_bind_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_mod_expression_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_new_array_from_range_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_object_array_conversion_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_prim_binary_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_prim_unary_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_rank_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_regex_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_removable_avg_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_removable_min_max_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_removable_minn_maxn_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_removable_push_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_removable_stddev_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_removable_sum_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_replace_one_expression_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_reverse_array_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_round_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_runtime_environment_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_set_expressions_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_shard_filter_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_to_upper_to_lower_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_topn_bottomn_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_trigonometric_expressions_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_trunc_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_ts_second_ts_increment_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_unwind_array_builtin_test.cpp",
        "//src/mongo/db/exec/sbe/expressions:sbe_variable_test.cpp",
        "//src/mongo/db/exec/sbe/util:stage_results_printer_test.cpp",
        "//src/mongo/db/exec/sbe/values:block_test.cpp",
        "//src/mongo/db/exec/sbe/values:bsoncolumn_materializer_test.cpp",
        "//src/mongo/db/exec/sbe/values:row_test.cpp",
        "//src/mongo/db/exec/sbe/values:slot_printer_test.cpp",
        "//src/mongo/db/exec/sbe/values:slot_test.cpp",
        "//src/mongo/db/exec/sbe/values:ts_block_test.cpp",
        "//src/mongo/db/exec/sbe/values:value_serialization_test.cpp",
        "//src/mongo/db/exec/sbe/values:value_test.cpp",
        "//src/mongo/db/query/stage_builder/sbe/tests:sbe_builder_test_fixture.h",
    ],
    tags = ["mongo_unittest_fourth_group"],
    deps = [
        ":sbe_plan_stage_test",
        "//src/mongo/db:service_context_d_test_fixture",
        "//src/mongo/db/auth:authmocks",
        "//src/mongo/db/pipeline:expression_context_for_test",
        "//src/mongo/db/query:query_test_service_context",
        "//src/mongo/db/query/collation:collator_interface_mock",
        "//src/mongo/db/timeseries:bucket_compression",
        "//src/mongo/idl:server_parameter_test_util",
        "//src/mongo/unittest",
        "//src/mongo/util:pcre_wrapper",
    ],
)

mongo_cc_benchmark(
    name = "abt_lower_bm",
    srcs = [
        "//src/mongo/db/exec/sbe/abt:abt_lower_bm.cpp",
    ],
    deps = [
        ":abt_unit_test_utils",
        ":query_sbe_abt",
        "//src/mongo/unittest",
    ],
)

mongo_cc_benchmark(
    name = "sbe_expression_bm",
    srcs = [
        "//src/mongo/db/exec/sbe/expressions:sbe_expression_bm.cpp",
    ],
    deps = [
        ":query_sbe_stages",
        "//src/mongo/db:query_exec",
        "//src/mongo/db:service_context_non_d",
        "//src/mongo/db/auth:authmocks",
        "//src/mongo/db/pipeline:expression_bm_fixture",
        "//src/mongo/db/pipeline:expression_context_for_test",
        "//src/mongo/db/query:query_test_service_context",
    ],
)
